<admintpl file="header" />
<style>
    a{cursor: pointer;}
    .fl{float:left;}
    .c-pages{padding:20px 0; text-align: center;}
    .c-pages.tl{text-align: left;}
    .c-pages span{display: inline-block; margin-right: 5px; font-size:12px; height:28px; line-height: 28px;}
    .c-pages span.col{color: #fe344e; font-weight: 600;}
    .c-pages span a{display: inline-block; margin:0 3px; height:28px; line-height: 28px; text-align: center; padding:0 12px; border:1px solid #ccc; text-decoration: none; border-radius: 2px;}
    .c-pages span a:link,.c-pages span a:active,.c-pages span a:visited{color: #333;}
    .c-pages span a:hover{ color: #157efb; border: 1px solid #157efb;}
    .c-pages span a.active{color: #fff; background: #157efb; border:1px solid #157efb;}
    .c-pages  .current{ color: #fff; background: #157efb; border: 1px solid #157efb; display: inline-block; margin: 0 3px; height: 28px;
        line-height: 28px;
        text-align: center;
        padding: 0 12px;
        text-decoration: none;
        border-radius: 2px;
    }
    .addWei{background: none; border:1px solid #ff8540; color: #ff8540; padding:4px 6px; font-size: 14px;margin-top:4px;margin-left:-40px;}
    .btns{background: none; border:1px solid #ff8540; color: #ff8540; padding:4px 6px; font-size: 14px;margin-top:4px;}
    .btnfx{cursor: pointer; width:60px; height:28px;line-height:28px; border:1px solid #07a9ff; color: #07a9ff; border-radius: 4px; background: none; }
</style>
<body class="J_scroll_fixed">
<div class="wrap J_check_wrap">
    <ul class="nav nav-tabs">
        <li class="active" ><a>热门城市</a></li>
    </ul>
    <br />
    <form action="{:U('Hotcity/hot_add')}" method="post" id="form">
        <div>
            <span>
                热门城市名称<input type="text" name="name" id="name" style="width: 200px;margin-left: 30px;margin-right: 10px">
                <!--<a class="btn btn-danger" >添加</a>-->
                <input class="btn btn-danger" type="button" value="添加" onclick="sav()" style="margin-top: -8px">
            </span>
        </div>
    </form>



    <div id="mydiv" style="width: 650px">
        <table class="table table-hover table-bordered">
            <thead >
            <tr >
                <th style="text-align: center">序号</th>
                <th style="text-align: center">热门城市名称</th>
                <th style="text-align: center">添加时间</th>
                <th style="text-align: center">操作</th>
            </tr>
            </thead>
            <foreach name="data" item="v" key="k">
                <tr>
                    <td style="text-align: center">{$k+1}</td>
                    <td style="text-align: center">{$v.name}</td>
                    <td style="text-align: center"><?php echo date('Y-m-d',$v['ctime']); ?></td>
                    <td style="text-align: center">
                        <a href="{:U('Hotcity/hot_edit',array('id'=>$v['id']))}">修改</a>
                        <a onclick="del({$v.id})">删除</a>
                    </td>
                </tr>
            </foreach>
        </table>



    </div>
</div>
</body>
</html>
<script type="text/javascript" src="__PUBLIC__/js/layer/layer.js"></script>
<script>
function sav(){
    var name = $("#name").val();
    if(name==""){
//        alert("来访目的不能为空");
        layer.open({
            content: '--热门城市名称不能为空--',
            btn: '确定'
        });
        return false;
    }
    $("#form").submit();
}

function del(id){

    if(layer.confirm('是否删除该热门城市？')){
        $(".layui-layer-btn0").click(function(){
            window.location.href="index.php?g=admin&m=Hotcity&a=hot_del&id="+id;
        })
    }
}


</script>